﻿using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RK.SerivesPlugin.BPW
{
    [Description("BPW:采购情况检查，采购情况检查记录"), HotUpdate]
    public class DzPurCheckQtyDate : AbstractOperationServicePlugIn
    {
        public override void BeforeDoSaveExecute(BeforeDoSaveExecuteEventArgs e)
        {
            base.BeforeDoSaveExecute(e);
            var obj = e.DataEntities.FirstOrDefault();
            var operationNumber = this.FormOperation.Operation;
            string xgName = "";
            if (operationNumber == "XRIS_tbQty")
            {
                xgName = "修改数量";
            }
            else if (operationNumber == "XRIS_tbDate")
            {
                xgName = "修改日期";
            }
            else if (operationNumber == "XRIS_tbNextMonth")
            {
                xgName = "推迟1个月";
            }
            DynamicObjectCollection rows = obj["FEntity"] as DynamicObjectCollection;
            foreach (var row in rows)
            {
                row["F_OpNumber"] = xgName;
            }
        }
        //public override void BeforeExecuteOperationTransaction(BeforeExecuteOperationTransaction e)
        //{
        //    base.BeforeExecuteOperationTransaction(e);
        //    var obj = e.SelectedRows.Select(s => s.DataEntity).FirstOrDefault();
        //    var operationNumber = this.FormOperation.Operation;
        //    string xgName = "";
        //    if (operationNumber == "XRIS_tbQty")
        //    {
        //        xgName = "修改数量";
        //    }
        //    else if (operationNumber == "XRIS_tbDate")
        //    {
        //        xgName = "修改日期";
        //    }
        //    else if (operationNumber == "XRIS_tbNextMonth")
        //    {
        //        xgName = "推迟1个月";
        //    }
        //    DynamicObjectCollection rows = obj["FEntity"] as DynamicObjectCollection;
        //    foreach (var row in rows)
        //    {
        //        row["F_OpNumber"] = xgName;
        //    }
        //}
    }
}
